/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Minh Luc
 */
@Entity
@Table(name = "Job", catalog = "P2PDB", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "Job.findAll", query = "SELECT j FROM Job j"),
    @NamedQuery(name = "Job.findByJobId", query = "SELECT j FROM Job j WHERE j.jobId = :jobId"),
    @NamedQuery(name = "Job.findByJobTitle", query = "SELECT j FROM Job j WHERE j.jobTitle = :jobTitle"),
    @NamedQuery(name = "Job.findByJobDescripton", query = "SELECT j FROM Job j WHERE j.jobDescripton = :jobDescripton"),
    @NamedQuery(name = "Job.findByJobLimitPerYear", query = "SELECT j FROM Job j WHERE j.jobLimitPerYear = :jobLimitPerYear")})
public class Job implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "JobId", nullable = false)
    private Integer jobId;
    @Column(name = "JobTitle", length = 100)
    private String jobTitle;
    @Column(name = "JobDescripton", length = 2147483647)
    private String jobDescripton;
    @Column(name = "JobLimitPerYear", precision = 19, scale = 4)
    private BigDecimal jobLimitPerYear;
    @OneToMany(mappedBy = "job")
    private Collection<Users> usersCollection;

    public Job() {
    }

    public Job(Integer jobId) {
        this.jobId = jobId;
    }

    public Integer getJobId() {
        return jobId;
    }

    public void setJobId(Integer jobId) {
        this.jobId = jobId;
    }

    public String getJobTitle() {
        return jobTitle;
    }

    public void setJobTitle(String jobTitle) {
        this.jobTitle = jobTitle;
    }

    public String getJobDescripton() {
        return jobDescripton;
    }

    public void setJobDescripton(String jobDescripton) {
        this.jobDescripton = jobDescripton;
    }

    public BigDecimal getJobLimitPerYear() {
        return jobLimitPerYear;
    }

    public void setJobLimitPerYear(BigDecimal jobLimitPerYear) {
        this.jobLimitPerYear = jobLimitPerYear;
    }

    public Collection<Users> getUsersCollection() {
        return usersCollection;
    }

    public void setUsersCollection(Collection<Users> usersCollection) {
        this.usersCollection = usersCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (jobId != null ? jobId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Job)) {
            return false;
        }
        Job other = (Job) object;
        if ((this.jobId == null && other.jobId != null) || (this.jobId != null && !this.jobId.equals(other.jobId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Job[jobId=" + jobId + "]";
    }

}
